<template>
    <div class="tw-back-btn">
      <a
        @click="handleClick"
        @mouseover="handleMouseEnter"
        @mouseout="handleMouseOut"
        :style="{opacity:opacity}">
        <img v-show="imgEnter"
          src="@/assets/images/back1-1.png" alt="">
        <img v-show="!imgEnter"
          src="@/assets/images/back1-2.png" alt="">
      </a>
    </div>
</template>

<script>
export default {
  name: 'tw-back-btn',
  props: ['url'],
  data () {
    return {
      opacity: 1,
      imgEnter: true
    }
  },
  methods: {
    handleClick: function () {
      this.$router.push({ path: this.url })
    },
    handleMouseEnter: function () {
      this.opacity = 1
      this.imgEnter = false
    },
    handleMouseOut: function () {
      this.opacity = 1
      this.imgEnter = true
    }
  }
}
</script>

<style scoped lang="scss">
.tw-back-btn{
  z-index: 20;
  position: absolute;
  left: 0;
  bottom: 20px;
  a{
    display: inline-block;
    width: 100%;
    height: 100%;
  }
  img{
    width: 100%;
  }
}
</style>
